package com.example.websocket.dto;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.type.TypeReference;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

@Getter
@Setter
public class WSMessageResultDTO implements Serializable {

    private String type;


    private Object data;

    public WSMessageResultDTO() {
    }
    public WSMessageResultDTO(String type, Object data) {
        this.type = type;
        this.data = data;
    }

    public<T> T dataBy(Class<T> t) {
        return JSON.parseObject(JSON.toJSONString(data),t);
    }

}
